<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"
	import="java.util.*,java.sql.*,com.telecom.cms.util.*"%>
<jsp:directive.page import="com.telecom.cms.dao.*" />
<jsp:directive.page import="com.telecom.cms.dto.*" />
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
	prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
	prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
	prefix="logic"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link rel="stylesheet" type="text/css" href="images/main.css">
		<STYLE type=text/css>
BODY {
	SCROLLBAR-FACE-COLOR: #f2f2f2;
	SCROLLBAR-HIGHLIGHT-COLOR: #f2f2f2;
	SCROLLBAR-SHADOW-COLOR: #b7b7b7;
	SCROLLBAR-3DLIGHT-COLOR: #f2f2f2;
	SCROLLBAR-ARROW-COLOR: #999999;
	SCROLLBAR-TRACK-COLOR: #e9e9e9;
	SCROLLBAR-DARKSHADOW-COLOR: #f2f2f2;
	margin-left: 0px;
}
</STYLE>
		<script type="text/javascript" language="javascript">
        function f(){
        
       
          var r = <%
                    List list1 = (List)request.getSession().getAttribute("Outputlist");
                    out.print(null==list1?0:list1.size());
   
          %> ;
          var m = <%
          
                    List list2 = (List)request.getSession().getAttribute("AtomList");
                    out.print(null==list2?0:list2.size());
          %> ;
      

          if(r==0||m==0)
            {
        
              alert("请选择查询的条件和结果!!"); 
              return;    
          
            } 
          var p = document.form1.billing_cycle_y.value;
          var q = document.form1.billing_cycle_m.value;
          var oldlatnid = <%=request.getSession().getAttribute("oldid")%>
          
          if(oldlatnid==1000){var latnid = document.form1.selectlatnid.value; }
          if(p==00||q==00){
              alert("请定制账务月!!"); 
              return;      
          }   
		 	var purpose=document.getElementById("purpose").value;
		 	if(oldlatnid!=1000){
			 	h="querywaitting.jsp?billing_cycle_y="+p+"&billing_cycle_m="+q+"&purpose="+purpose;
		 		window.open(h,"请等待","");
		 	}else{
		 		h="querywaitting.jsp?billing_cycle_y="+p+"&billing_cycle_m="+q+"&selectlatnid="+latnid+"&purpose="+purpose;
		 		window.open(h,"请等待","");
		 	}
		 	

       }
       
       	function deleteCollection(){
		   if(confirm("是否删除收藏的模板？")){
		   document.form1.action="collectionDel.do" ;
		   document.form1.target="rsFrame";
           document.form1.submit(document.form1.parfolderid);
		}
       }
          
       function resetvalue(){
       
       
          var r = <%
                    List list3 = (List)request.getSession().getAttribute("Outputlist");
                    out.print(null==list3?0:list1.size());
   
          %> ;
          var m = <%
          
                    List list4 = (List)request.getSession().getAttribute("AtomList");
                    out.print(null==list4?0:list2.size());
          %>;
      

          if(r==0||m==0)
            {
        
              return  ;    
          
            } 

              
              document.form1.action="atomReset.do";
              document.form1.target="upFrame";
              document.form1.submit();
       
       }  
       
       function again(){
       
            document.form1.action="clear.do";
            document.form1.target="_self";
            document.form1.submit();    
       
       }
       
       window.parent.outer_frame.rows="0,15,*"; 
        </script>

	</head>

	<body>
		<form action="query.do" target="_blank" onSubmit="return f()"
			name="form1">
			<table width="780" cellspacing="0" cellpadding="0" border="0">
				<tbody>
					<tr>
						<td width="3" height="31">
							<img height="31" src="images/table_01.gif" width="3">
						</td>
						<td background="images/table_02.gif" height="31">
							<table cellspacing="0" cellpadding="0" width="146" align="left"
								border="0">
								<tbody>
									<tr>
										<td width="51" background="images/title_1_bg.gif">
											<img height="31" src="images/title_1.gif" width="51">
										</td>
										<td width="95" background="images/title_1_bg.gif">
											<span class="color_b_666">条件定制结果</span>
										</td>
									</tr>
								</tbody>
							</table>
						</td>
						<td width="3">
							<img height="31" src="images/tab
							le_03.gif" width="3">
						</td>
					</tr>
					<tr>
						<td height="172">
							<img height="100%" src="images/table_04.gif" width="3">
						</td>
						<td style="PADDING-TOP: 3px" valign="top">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							</table>
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td>
										<table width="771" border="0" cellpadding="1" cellspacing="1"
											class="moduleList" bgcolor="#D5D5D5" align="center">
											<tr>
												<td background="images/table_02.gif" colspan="3">
													条件定制
												</td>
											</tr>
											<tr bgcolor="#FFFFFF">
												<td width="163" align="center">
													条件说明
												</td>
												<td width="448" align="center">
													条件数值
												</td>
												<td width="129" align="center">
													删除所选条件
												</td>
											</tr>
											<tr bgcolor="#FFFFFF">
												<%
													Calendar myCalendar = Calendar.getInstance();
												%>
												<td align="center">
													账务月
												</td>
												<td align="center">
													<select name="billing_cycle_y">
														<%
															for (int myYear = 2006; myYear < 2010; myYear++) {
														%>
														<option value="<%=myYear%>"
															<%=(myCalendar.get(1) == myYear ? "selected" : "")%>>
															<%=myYear%>
														</option>
														<%
															}
														%>
													</select>
													<select name="billing_cycle_m">
														<%
															for (int myMon = 1; myMon < 13; myMon++) {
														%>
														<option value="<%=myMon%>"
															<%=(myCalendar.get(2) == myMon ? "selected" : "")%>>
															<%=myMon%>
															月
														</option>
														<%
															}
														%>
													</select>
												</td>
												<td align="center">
													&nbsp;


												</td>
											</tr>
											<tr bgcolor="#FFFFFF">
												<td align="center">
													本地网
												</td>
												<td align="center">
													<%
														String latndesc = ((String) session.getAttribute("latndesc"))
																.trim();
														out.print(latndesc);
														if (latndesc.equals("湖北省中心")) {
															out.print("请选择：");
															List latnidlist = new LOC_LATNDAO().findAll();
															Iterator i = latnidlist.iterator();

															out.print("<select name=selectlatnid>");

															while (i.hasNext()) {
																LOC_LATNDTO dto = (LOC_LATNDTO) (i.next());
																String id = dto.getLatn_id();
																if (id.equals("1000")) {
																	continue;
																}
																String desc = dto.getLatn_desc();
																out.print("<option value=" + id + ">" + desc + "</option>");
															}
															out.print("</select>");

														}
													%>
												</td>
												<td align="center">
												</td>
											</tr>

											<c:forEach var="atom" items="${AtomList}">
												<tr bgcolor="#FFFFFF">
													<td align="center">
														${atom.atomname}
													</td>
													<td align="center">
														${atom.chinesevalue}
													</td>
													<td align="center">
														<a href="deletrecord.do?recordname=${atom.atomid}">删除</a>
													</td>
												</tr>
											</c:forEach>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<table width="771" height="93" cellpadding="1" cellspacing="1"
											class="moduleList" bgcolor="#D5D5D5" align="center">
											<tr>
												<td background="images/table_02.gif" colspan="3">
													结果定制
												</td>
											</tr>
											<tr bgcolor="#FFFFFF">
												<%
													List outputlist = (List) session.getAttribute("Outputlist");
													if (outputlist != null) {
														int j = 0;
														for (int i = 0; i < outputlist.size(); i++) {
															if (j % 3 == 0 && j != 0) {
																out.print("</tr><tr bgcolor=#FFFFFF>");
															}
												%>
												<td align="center" width="257">
													<%
																			SEG_BIZ_ATOM_DEFDTO dto = (SEG_BIZ_ATOM_DEFDTO) outputlist
																			.get(i);
																			String name = dto.getBIZ_ATOM_NAME();
																			out.print(name);
													%>
												</td>
												<%
													j++;
														}
														if (j % 3 != 0) {
															for (int i = 0; i < (3 - j % 3); i++) {
																out.print("<td width=257></td>");
															}
														}
													}
												%>
											</tr>
											<tr bgcolor="#FFFFFF">
												<td colspan="3" align="center" valign="bottom">

													<input type="button" name="Submit" value="删除收藏"
														onClick="deleteCollection()" />
													<input type="button" name="reset" value="修改定制"
														onClick="resetvalue()">
													<input type="button" name="reset" value="清除本次选择"
														onClick="again()">
													<input type="button" name="Submit3" value="结果查询"
														onclick="f()" />

												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
						<td background="images/table_05.gif">
							<img height="53" src="images/table_05.gif" width="3">
						</td>
					</tr>
					<tr>
						<td>
							<img height="12" src="images/table_06.gif" width="3">
						</td>
						<td height="3">
							<img height="3" src="images/table_07.gif" width="100%">
						</td>
						<td>
							<img height="12" src="images/table_08.gif" width="3">
						</td>
					</tr>
				</tbody>
			</table>
			<%
					//用于传递选择的热点收藏名称作为目的
					String folderid = request.getParameter("id");
					if (folderid == null)
						folderid = (String) request.getAttribute("id");
					String foldername = null;
					Connection con = GetConnect.getCsConnection();
					Statement state = con.createStatement();
					ResultSet rs = state.executeQuery("select foleder_name from "
					+ Constant.SEG_USER_FOLDER_DEF + " where foleder_id="
					+ folderid);
					if (rs.next()) {
						foldername = rs.getString("foleder_name");
					}
			%>
			<input type="hidden" name="parfolderid" value=<%=folderid%>>
			<input type="hidden" name="purpose" id="purpose"
				value=<%=foldername%>>
		</form>
	</body>
</html>
